﻿Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.IO


' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class Service
     Inherits System.Web.Services.WebService


    <WebMethod()> _
    Public Function SaveJPEG(ByVal strJPEG As String) As String

        'saves an uploaded photo and returns a unique name reference

        Dim BinaryContent As Byte() = Convert.FromBase64String(strJPEG)

        Try
            'generate a unique name (GUID) for the filename
            Dim strFileName As String = System.Guid.NewGuid.ToString("n")
            'MAKE SURE to change the save path!
            Dim fStream As New FileStream("C:\Users\Puni\Desktop\Servicio_Catering\Imagenes\Distribucion_Mesas\Salon.jpg", FileMode.CreateNew)

            Dim bw As New BinaryWriter(fStream)

            bw.Write(BinaryContent)
            bw.Close()
            fStream.Close()

            System.Diagnostics.Process.Start("http://localhost:50823/Eventos_de_Cliente.aspx")
            'return the filename for use in Flash
            Return strFileName

        Catch ex As Exception

            Return ex.Message

        End Try

    End Function

End Class
